package xgenerator.ui.swing.model;

import java.util.Vector;

import javax.swing.DefaultComboBoxModel;

import xgenerator.service.MetadataService;
import xgenerator.service.impl.MetadataServiceImpl;

public class DatasourceComboBoxModel extends DefaultComboBoxModel {
	/**
	 * Serializable
	 */
	private static final long serialVersionUID = 1L;
	
	private MetadataService metadataService;

	public DatasourceComboBoxModel() {
		this.metadataService = new MetadataServiceImpl();
	}

	/**
	 * <p>
	 * Title：加载列表数据
	 * </p>
	 * 
	 * @author <a href="mailto:shushanlee@msn.com">liss</a>
	 */
	public void loadData() {
		this.removeAllElements();
		Vector dataVector = this.metadataService.getDataSourceNames();
		for (int i = 0; i < dataVector.size(); i++) {
			this.addElement(dataVector.get(i));
		}
	}
}
